using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using UWBGL_WinForms_Lib1;
using UWBGL_XNA_Lib13;

namespace XNA_SceneNode
{
	public partial class XNA_SceneNode : Form
	{
		private DrawHandlerBig _viewBig;
		private DrawHandlerMinimap _viewMinimap;
		private Timer mTimer;

		public XNA_SceneNode()
		{
			_viewBig = new DrawHandlerBig();
			_viewMinimap = new DrawHandlerMinimap();

			mTimer = new Timer();
			InitializeComponent();
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			_viewBig.Initialize(PlaceHolder_Graphics);

			_viewMinimap.Initialize(placeholder_minimap);

			UWB_BoundingBox worldBounds = Program.getModel().getWorldBounds();
			_viewMinimap.setWCWindow(ref worldBounds);
			_viewBig.addReferenceofMinimap(ref _viewMinimap);

			UWBGL_XNA_Lib13.UWB_Utility.mEchoTextBox = echoTextBox;

			//set our timer's interval in milliseconds and set the mTimer_Tick function to be
			//called every time it reaches that interval
			mTimer.Interval = 25;
			mTimer.Tick += new EventHandler(mTimer_Tick);
			mTimer.Start();

			float width = 0;
			float height = 0;

			Program.getModel().getWorldBounds(ref width, ref height);


			UWBGL_XNA_Lib13.UWB_Utility.echoToStatusArea("Form Load Complete");
		}

		private void Button_Quit_Click(object sender, EventArgs e)
		{
			Close();
		}

		private void mTimer_Tick(object sender, EventArgs e)
		{
			Program.getModel().updateSimulation();

			_viewBig.DrawGraphics();
			_viewMinimap.DrawGraphics();
		}

		private void sceneTreeControl1_Load(object sender, EventArgs e)
		{

		}

		private void sliderControlWithEcho1_Scroll(object sender, EventArgs e)
		{
			Program.getModel().setBulletFrequency((int) sliderControlWithEcho1.GetSliderValue());
		}
	}
}
